import DBConfig from '@CONFIG/DBConfig'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const socketIOClient = require('socket.io-client')
export const initSocket: unknown = (userId: string, username: string) => {
  if (!socketIOClient) return null
  const socketURL = `${DBConfig.socketUrl}?userId=${userId}`
  console.log('Connection,', socketURL)
  const socket = socketIOClient(socketURL);
  console.log('Socket Join, ', username)
  socket.emit('join', {
    username
  });
  return socket
}
